#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int getDecimalValue(ListNode* head) {
        ListNode* pcur = head;
        int ret = 0;
        while (pcur != nullptr)
        {
            ret = ret * 2 + pcur->val;
            pcur = pcur->next;
        }
        return ret;
    }
};